var express = require('express');
var router = express.Router();
const hl = require("../sql/homeList")
const sql = require("../sql")



/**
* @apiGroup 招聘信息
* @api {get} /api/hl homeList
* @apiVersion 0.0.0
* @apiDescription 请求所有数据
* @apiParam {String} titlee 数据题头
* @apiSuccess {number} code 请求状态，0为请求失败，1为请求成功，2为不想给你
* @apiSuccess {string} titles 请求说明
* @apiSuccess {array} msg 请求数据
* @apiSuccessExample {json} Success-Response:
* {
*    "code":200,
*    "titles":"请求成功",
*    "msg":[{},{},...]
* }
* @apiSampleRequest http://1.15.180.181:3000/api/hl
*/

// 接口功能路由
router.get('/', function(req, res, next) {
    const titlee = req.query.titlee || "";
    const ops = {
        colName:hl
    }
    if(titlee){
        ops.where = {title: titlee}
    }
    sql.get(ops).then(data=>{
        res.send({
            code:0,
            titles:"获取成功",
            data
        })
    })
});


module.exports = router;